package demo5;

import org.springframework.stereotype.Component;
import javax.annotation.Resource;

@Component
public class Person {
//    @Resource(name="sweater")//name中指定类名,注意:首字母需要小写,其余后续与类名一致
//    private Clothes clothes;
    @Resource
    private Clothes shirt;//如果属性名与类名一致(仅首字母小写)也可以进行装配

    @Override
    public String toString() {
        return "Person{" +
                "clothes=" + shirt +
                '}';
    }
}
